package com.meta.platform.oplog.aop;

/**
 * 操作类型枚举定义
 * @author xieshanwu
 */
public enum OperateTypeEnum {

    CREATE (1, "增加"),
    DELETE(2, "删除"),
    UPDATE(3, "修改"),
    QUERY(4, "查询");
    private Integer code;

    private String desc;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    OperateTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static OperateTypeEnum getByCode(Integer code) {
        for (OperateTypeEnum operateTypeEnum : values()) {
            if (operateTypeEnum.getCode().equals(code)) {
                //获取指定的枚举
                return operateTypeEnum;
            }
        }
        return null;
    }
}
